<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>动力金融网 - 专业的互联网金融信息服务平台</title>
    <script type="text/javascript" th:src="@{/js/jquery-1.7.2.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/trafficStatistics.js}"></script>
    <link rel="stylesheet" type="text/css" th:href="@{/css/share.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/base.css}"/>
</head>

<body>
<!-- 页头start -->
<div id="header">
    <div th:include="commons/header :: html"></div>
</div>
<!--页头end-->

<!-- 二级导航栏start -->
<div th:include="commons/subNav :: html"></div>
<!-- 二级导航栏end -->

<div class="mainBox">
    <div class="homeWap">
        <!--账户信息start-->
        <div class="credenMain clearfix">
            <div class="dog-ear"></div>
            <div class="credenBasic">
                <div class="credenName">
                    <div class="head">

                        <span th:if="${session.loginUser.headerImage == null}">
                            <span><img id="user_photo" th:src="@{/images/header.png}"
                                       width="90" height="90"/></span>
                        </span>
                        <span th:if="${session.loginUser.headerImage != null}">
                            <!--<span><img id="user_photo" th:src="@{/header/{headerImage}(headerImage=${session.loginUser.headerImage})}"-->
                                       <!--width="90" height="90"/></span>-->
                            <span><img id="user_photo" th:src="|../../header/${session.loginUser.headerImage}|"
                                         width="90" height="90"/></span>
                        </span>
                        <!-- 隐藏的上传标签 调出窗口 -->
                        <input id="file" type="file" name="header" style="display: none"/>
                        <!--<a th:href="@{/loan/uploadHeader}">上传头像</a>-->
                        <a href="#" onclick="uploadHeader()">上传头像</a>
                    </div>
                    <script type="text/javascript">
                        function uploadHeader() {
                            // 弹出上传框
                            $("#file").click();
                            // 点击上传 请求后端
                            $("#file").change(function () {
                                // 获取文件列表
                                var file = $('#file')[0].files;
                                // 判断是否选择了文件
                                if (!(file.length > 0)) {
                                    alert('请上传文件');
                                    return;
                                }
                                // 创建formdata
                                var fd = new FormData();
                                // 向formdata中传入数据
                                // file是一个伪数组
                                fd.append('header', file[0]);
                                // 用ajax传送数据
                                $.ajax({
                                    type: 'post',
                                    url: rootPath + '/loan/uploadHeader',
                                    // 数据不需要编码
                                    contentType: false,
                                    // 数据对象不需要转换成键值对格式
                                    processData: false,
                                    data: fd,
                                    /*beforeSend: function() {
                                        $('#file').show()
                                    },
                                    complete: function() {
                                        $('#file').hide()
                                    },*/
                                    success: function (data) {
                                        if (data.code == 0) {
                                            alert(data.message)
                                        }else {
                                            alert("文件上传成功！");
                                        }
                                    }
                                });

                            });

                        }
                    </script>
                    <h3 class="name">

                        <sapn th:if="${session.loginUser.name == null}">
                            <a th:href="@{/loan/page/register/toRealName}">请认证姓名</a>
                        </sapn>
                        <span th:if="${session.loginUser.name != null}">
                            <span th:text="${session.loginUser.name}">张三</span>
                        </span>
                    </h3>
                    <h4></h4>
                    <h4 th:text="${session.loginUser.phone}">13725698888</h4>
                    <h4>最近登录：<span th:text="${#dates.format(session.loginUser.lastLoginTime,'yyyy-MM-dd HH:mm:ss')}">2017-05-21 15:23:36</span></h4>
                </div>
                <i class="borderRight"></i>
                <ul class="credenBalance">
                    <li class="availMoney">
                        <h3>可用余额：</h3>
                        <span class="moneyIcon"><i id="availableMoney" onclick="showMoney()">¥ 9000.0 元</i></span>
                        <a class="recharge" th:href="@{/loan/page/toRecharge}">充值</a>
                        <a class="inves" th:href="@{/loan/loan(pType=2)}">投资</a>
                    </li>
                    <script type="text/javascript" th:inline="javascript">
                        var availableMoney = [[${financeAccount.availableMoney}]];
                        $(function () {
                            if (availableMoney >= 100000) {
                                $("#availableMoney").html("*****")
                            }else {
                                $("#availableMoney").html("¥ " + availableMoney + " 元");
                            }
                        });
                        function showMoney() {
                            if (availableMoney >= 1000000) {
                                alert("发送短信。。。");
                            }else {
                                $("#availableMoney").html("¥ " + availableMoney + " 元");
                            }
                        }
                    </script>
                </ul>
            </div>
        </div>
        <!--账户信息end-->

        <!--最新操作数据start-->
        <div class="allInvest clearfix">
            <div class="eachInvest invest-tab">
                <h3>最近投资</h3>
                <div class="invest-tab-box">
                    <dl>
                        <dt>
                            <span class="number" style="text-align:left;">序号</span>
                            <span class="number">投资产品</span>
                            <span class="money">投资金额</span>
                            <span class="profit">投资时间</span>
                        </dt>
                        <dd>
                            <span class="name">1</span>
                            <span class="number">个人消费贷</span>
                            <span class="money">5000.0</span>
                            <span class="profit">2017-06-12</span>
                        </dd>
                        <dd>
                            <span class="name">2</span>
                            <span class="number">个人消费贷</span>
                            <span class="money">5500.0</span>
                            <span class="profit">2017-05-02</span>
                        </dd>
                        <dd>
                            <span class="name">3</span>
                            <span class="number">个人消费贷</span>
                            <span class="money">3000.0</span>
                            <span class="profit">2017-01-01</span>
                        </dd>
                        <dd>
                            <span class="name">4</span>
                            <span class="number">个人消费贷</span>
                            <span class="money">3000.0</span>
                            <span class="profit">2017-01-01</span>
                        </dd>
                        <dd>
                            <span class="name">5</span>
                            <span class="number">个人消费贷</span>
                            <span class="money">3000.0</span>
                            <span class="profit">2017-01-01</span>
                        </dd>
                    </dl>
                    <div class="more-allinvest">
                        <a th:href="@{/loan/myInvest}"><span>查看全部投资</span><i></i></a>
                    </div>
                </div>
            </div>
            <div class="eachInvest invest-tab invest-tab-box">
                <h3>最近充值</h3>
                <dl>
                    <dt>
                        <span class="number" style="text-align:left;">序号</span>
                        <span class="number">充值描述</span>
                        <span class="money">充值金额</span>
                        <span class="money">充值时间</span>
                    </dt>
                    <dd>
                        <span class="name">1</span>
                        <span class="number">支付理财</span>
                        <span class="money">1000.0</span>
                        <span class="profit">2017-05-01</span>
                    </dd>
                    <dd>
                        <span class="name">2</span>
                        <span class="number">支付理财</span>
                        <span class="money">1000.0</span>
                        <span class="profit">2017-04-01</span>
                    </dd>
                    <dd>
                        <span class="name">3</span>
                        <span class="number">支付理财</span>
                        <span class="money">1000.0</span>
                        <span class="profit">2017-03-01</span>
                    </dd>
                    <dd>
                        <span class="name">4</span>
                        <span class="number">支付理财</span>
                        <span class="money">1000.0</span>
                        <span class="profit">2017-03-01</span>
                    </dd>
                    <dd>
                        <span class="name">5</span>
                        <span class="number">支付理财</span>
                        <span class="money">1000.0</span>
                        <span class="profit">2017-03-01</span>
                    </dd>
                </dl>
                <div class="more-allinvest">
                    <a th:href="@{/loan/myRecharge}"><span>查看全部充值</span><i></i></a>
                </div>
            </div>

            <div class="eachInvest recent-earnings">
                <h3>最近收益</h3>
                <dl id="recentearning">
                    <dt>
                        <span class="number" style="text-align:left;">序号</span>
                        <span class="number">项目名称</span>
                        <span class="number name" style="text-align:center;">收益日期</span>
                        <span class="profit">收益金额</span>
                    </dt>
                    <dd>
                        <span class="number" style="text-align:left;">1</span>
                        <span class="number">新手宝</span>
                        <span class="number name" style="text-align:center;">2017-05-12</span>
                        <span class="profit">12.6</span>

                    </dd>
                    <dd>
                        <span class="number" style="text-align:left;">2</span>
                        <span class="number">个人消费贷</span>
                        <span class="number name" style="text-align:center;">2017-04-11</span>
                        <span class="profit">100.6</span>

                    </dd>
                    <dd>
                        <span class="number" style="text-align:left;">3</span>
                        <span class="number">季度宝</span>
                        <span class="number name" style="text-align:center;">2017-03-08</span>
                        <span class="profit">1000.0</span>

                    </dd>
                    <dd>
                        <span class="number" style="text-align:left;">4</span>
                        <span class="number">季度宝</span>
                        <span class="number name" style="text-align:center;">2017-03-08</span>
                        <span class="profit">1000.0</span>

                    </dd>
                    <dd>
                        <span class="number" style="text-align:left;">5</span>
                        <span class="number">季度宝</span>
                        <span class="number name" style="text-align:center;">2017-03-08</span>
                        <span class="profit">1000.0</span>

                    </dd>
                </dl>
                <div id="moreRecentIncome" class="more-allinvest">
                    <a th:href="@{/loan/myIncome}"><span>查看全部收益计划</span><i></i></a>
                </div>
            </div>
        </div>
        <!--最新操作数据end-->
    </div>
</div>

<!--页脚start-->
<div th:include="commons/footer :: html"></div>
<!--页脚end-->
</body>
</html>